package cn.lg.soar.system.biz.modules.general.entity;

import cn.lg.soar.core.annotations.constraints.group.Create;
import cn.lg.soar.core.annotations.constraints.group.Update;
import cn.lg.soar.database.base.entity.BaseEntity;
import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import lombok.Data;

/**
 * 地址映射
 * @author luguoxiang
 * @since 2025-05-10
 * 开源项目：https://gitee.com/lgx1992/lg-soar 求star！请给我star！请帮我点个star！
 */
@Data
@Schema(description = "地址映射")
@TableName("lg_sys_url_mapping")
public class UrlMapping extends BaseEntity {

    /**  */
    @NotNull(message = "主键不能为空", groups = { Update.class })
    @ExcelIgnore
    @Schema(description = "主键")
    @TableId
    private Long id;

    /** 名称 */
    @NotBlank(message = "名称不能为空", groups = { Create.class, Update.class })
    @ExcelProperty(value = "名称")
    @Schema(description = "名称")
    private String name;

    /** 分组 */
    @NotNull(message = "分组不能为空", groups = { Create.class, Update.class })
    @ExcelProperty(value = "分组")
    @Schema(description = "分组")
    private String groupCode;

    /** 业务类型 */
    @NotBlank(message = "业务类型不能为空", groups = { Create.class, Update.class })
    @ExcelProperty(value = "业务类型")
    @Schema(description = "业务类型")
    private String bizType;

    /** 映射地址 */
    @NotBlank(message = "映射地址不能为空", groups = { Create.class, Update.class })
    @ExcelProperty(value = "映射地址")
    @Schema(description = "映射地址")
    private String url;

    @JsonIgnore
    @Override
    public Long primaryKey() {
        return this.id;
    }

}
